<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>

<head>
    <title>版本列表</title>
</head>

<body>

<div id="wrapper">
    <div class="gray-bg">
        <div class="row m-t-sm">
            <div class="col-lg-12">
                <ol class="breadcrumb f-fl">
                    <li>
                        <i class="fa fa-location-arrow"></i>  <a>版本管理</a>
                    </li>
                    <li class="active">
                        <strong>版本列表</strong>
                    </li>
                </ol>
                <span class="navbar-right  m-r m-t-8"><a href="${ctx}/admin/appVersion/edit?" class="btn-primary btn-add "> <i class='fa fa-plus-square-o'></i> 新 增</a></span>
            </div>
        </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox">
                        <div class="ibox-content">
                            <div class="search-area">
                                <form role="form" class="form-inline" id="queryform">
                                    <label for="appname">
                                        <input type="input" placeholder="应用名称" name="appname"
                                               id="appname"
                                               class="form-control form-filter"></label>
                                    <button class="btn btn-primary" type="button" onclick="submitFilter()"> 查询</button>
                                    <button class="btn btn-primary" datatable-clear type="button" onclick="clean()"> 清除</button>
                                </form>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover dataTables" id="data-table"></table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<!-- Page-Level Scripts -->
<script>
    $(document).ready(function () {
        var setting = {
            "ajax": {
                "url": "${ctx}/admin/appVersion/list",
                "type": "POST"
            },
            "columns": [
                {"title": "应用名称", "data": "appname", "width": "10%", "orderable": true},
                {"title": "应用标识", "data": "appcode", "width": "10%", "orderable": true},
                {"title": "版本号", "data": "version", "width": "10%", "orderable": true},
                {"title": "编译号", "data": "build", "width": "10%", "orderable": true},
                {"title": "系统类型", "data": "osType", "width": "10%", "orderable": true},
                {"title": "强制更新", "data": "isForce", "width": "10%", "orderable": true},
                {"title": "操作", "data": null, "width": "10%", "orderable": true}
            ],
            "columnDefs": [
                {"targets": 4,
                    "render": function (data) {
                        if(data == 1){
                            return "Android";
                        }else if(data == 2){
                            return "ios";
                        } else{
                            return "-";
                        }
                    },
                    "orderable": true
                },
                {"targets": 5,
                    "render": function (data) {
                        if(data == true){
                            return "是";
                        }else if(data == false){
                            return "否";
                        } else{
                            return "-";
                        }
                    },
                    "orderable": true
                },
                {
                    "targets": 6,
                    "render": function (data, type, row, meta) {
                        var result =
                                "<a class='btn btn-xs default btn-editable' href='${ctx}/admin/appVersion/edit?id=" + data.id + "'><i class='fa fa-pencil-square-o'></i> 编辑 </a>"
                                + "<a class='btn btn-xs default btn-editable' data-opt data-opt-url='${ctx}/admin/appVersion/del' data-opt-pams='{\"id\":" + data.id + "}' data-opt-fun='$(\"#data-table\").DataTable().draw();'  ><i class='fa fa-minus-square-o'></i> 删除 </a>";
                        return result;
                    }
                }
            ],
            "order": [
                [0, "desc"]
            ]
        };
        /* Init DataTables */
        $('#data-table').DataTable(ehconfig.get_datatable_config(setting));
        submitFilter = function () {
            $('#data-table').DataTable().draw();
        }
    });
    function clean() {
        $('#username').val('');
    }


</script>

</body>

</html>
